<f:view
		xmlns="http://www.w3.org/1999/xhtml"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:a4j="http://richfaces.org/a4j"
		xmlns:rich="http://richfaces.org/rich"
		xmlns:ui="http://java.sun.com/jsf/facelets"
		xmlns:itdep="http://itdep.bsuir.by/jsf" xmlns:c="http://java.sun.com/jstl/core"
		>

	<ui:decorate template="/facelets/template/mainTemplate.xhtml">
		<f:loadBundle basename="bundle.department" var="departmentBundle"/>
		<ui:param name="title" value="#{planBundle.plans}"/>
		<ui:define name="center">
			<ui:decorate template="/facelets/template/centerTemplate.xhtml">
				<ui:define name="content">

					<h:panelGrid styleClass="centerHeader">
						<h:outputText value="#{planBundle.studyPlans}"/>
					</h:panelGrid>
					<ui:decorate template="/facelets/template/scrollableTableTemplate.xhtml">
						<ui:param name="title" value="Plans List"/>
						<ui:param name="actionBean" value="#{planBean}"/>
						<ui:param name="idPrefix" value="plansDic"/>
						<ui:param name="showAddLink" value="true"/>
						<ui:define name="editPanelContext">

							<h:panelGrid columns="2">
								<h:outputText value="#{planBundle.speciality}"/>
								<itdep:entitySelectMenu value="#{planBean.record.speciality}"
														entityType="speciality"
														format="{i18n.fullName}"
														required="true" styleClass="sizeCopmonent"/>

								<h:outputText value="#{planBundle.yearEntrance}"/>
								<h:inputText value="#{planBean.record.year}" id="plansYearEntrance"
											 styleClass="sizeCopmonent"/>

							</h:panelGrid>
							<h:outputText value="#{planBean.exceptionMessage}" id="exceptionMess"
										  style="color:red"/>
						</ui:define>

						<ui:define name="tableContext">
							<rich:column width="1%">
								<f:facet name="header">
									<h:outputText value="#{planBundle.number}"/>
								</f:facet>
								<h:outputText value="#{record.id}"/>
							</rich:column>
							<rich:column width="31%">
								<f:facet name="header">
									<h:outputText value="#{planBundle.speciality}"/>
								</f:facet>

								<itdep:entityOutput value="#{record.speciality}" format="{i18n.fullName}"
													locale="#{specialityBean.translationBean.locale}"/>

							</rich:column>
							<rich:column width="21%">
								<f:facet name="header">
									<h:outputText value="#{planBundle.yearEntrance}"/>
								</f:facet>
								<h:outputText value="#{record.year}"/>
							</rich:column>
							<rich:column width="21%">
								<f:facet name="header">
									<rich:spacer/>
								</f:facet>
								<h:commandLink value="#{planBundle.details}" action="#{planBean.showPlanDetails}"/>

							</rich:column>
						</ui:define>

					</ui:decorate>


				</ui:define>
				<ui:define name="search">
					<a4j:form>
						<h:panelGrid id="filterPanel">
							<h:outputText value="#{planBundle.speciality}"/>
							<itdep:entitySelectMenu
									value="#{planBean.filter.speciality}"
									entityType="speciality" format="{i18n.fullName}" anyValue="true"
									style="width:100px">
								<a4j:support event="onchange" reRender="plansDicTable,filterPanel"
											 ajaxSingle="true"/>
							</itdep:entitySelectMenu>

							<h:outputText value="#{planBundle.yearEntrance}"/>
							<h:selectOneListbox value="#{planBean.filter.year}" id="year"
												style="width:100px" size="1">
								<f:selectItem itemValue=""/>
								<c:forEach items="#{planBean.year}" var="year" varStatus="status">
									<f:selectItem itemValue="#{year}"/>
								</c:forEach>
								<a4j:support event="onchange" reRender="plansDicTable" ajaxSingle="true"/>
							</h:selectOneListbox>
						</h:panelGrid>
					</a4j:form>
				</ui:define>
			</ui:decorate>
		</ui:define>
	</ui:decorate>
</f:view>